#! /bin/sh
# script for demonstrating sugabor
# The input data are chirps and the output are time-frequency plots
WIDTH=300
HEIGHT=400
WIDTHOFF1=0
WIDTHOFF2=315
WIDTHOFF3=630
WIDTHOFF4=945
HEIGHTOFF1=50
HEIGHTOFF2=500

perc=99

# bandwidth parameter (use the default)
band=

# vibrodata.1 100hz-5hz
suvibro f1=100 f2=5 tv=1.0 t1=.1 t2=.1  >vibrodata.1
suxgraph <vibrodata.1 perc=$perc \
	title="VibroData: 100-5hz"\
	label1="Time (sec)" label2="" \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF1}+${HEIGHTOFF1} &

sugabor <vibrodata.1 band=$band |
suxmovie  perc=$perc cmap=hue \
	title="Gabor Transform"\
	label1="Time (sec)" label2="Freq (hz)" \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF2}+${HEIGHTOFF1} &

# narrow band 40hz-50hz
suvibro f1=40 f2=50 tv=1.0 t1=.1 t2=.1  >vibrodata.2
suxgraph <vibrodata.2 perc=$perc \
	title="VibroData: 40-50hz"\
	label1="Time (sec)" label2="" \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF3}+${HEIGHTOFF1} &


sugabor <vibrodata.2 band=$band |
suxmovie  perc=$perc \
	title="Gabor Transform"\
	label1="Time (sec)" label2="Freq (hz)" \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF4}+${HEIGHTOFF1} &

# upsweep
suvibro f1=5 f2=120 tv=1.0 t1=.2 t2=.2  >vibrodata.3
suxgraph <vibrodata.3 perc=$perc \
	title="VibroData: 5-120hz"\
	label1="Time (sec)" label2="" \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF1}+${HEIGHTOFF2} &

sugabor <vibrodata.3 band=$band | suop op=norm |
suxmovie  perc=$perc \
	title="Gabor Transform"\
	label1="Time (sec)" label2="Freq (hz)" \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF2}+${HEIGHTOFF2} &

# sum of vibrodata.1, narrow band, upsweep
susum vibrodata.1 vibrodata.2 >junktmp.vibro
susum junktmp.vibro vibrodata.3 >vibrodata.4
rm junktmp.vibro

suxgraph <vibrodata.4 perc=$perc \
	title="Sum of All"\
	label1="Time (sec)" label2="" \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF3}+${HEIGHTOFF2} &

sugabor <vibrodata.4 band=$band |
suxmovie  perc=$perc \
	title="Gabor Transform"\
	label1="Time (sec)" label2="Freq (hz)" \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF4}+${HEIGHTOFF2} &

exit 0
